<template>
	<el-table :data="documents" style="width: 70%">
	    <el-table-column prop="documentName" label="文档名称" width="180" />
	    <el-table-column prop="userId" label="文档上传者" width="120" />
		<el-table-column prop="documentClass" label="文档分类" width="120"/>
		<el-table-column prop="documentState" label="文档状态" width="120"/>

	    <el-table-column prop="documentDate" label="文档上传日期" width="120"/>
		<el-table-column fixed="right" label="操作" width="120">
		    <template #default="scope">

				<el-button link type="primary" size="small" @click.prevent=" deleteRow(scope.$index)" ><!-- deleteRow(scope.$index) -->
					删除
				</el-button>

		    </template>
		</el-table-column>
	</el-table>


	<el-dialog v-model="documentDialogVisible" title="文档信息">

		文档内容：{{documents[num].documentContent}}<br />


		<el-button type="primary" @click="documentDialogVisible=false">确认</el-button>
	</el-dialog>


	



</template>

<script>
	import qs from 'qs'
	export default {
			data() {
				return {
					documents:[],
					document:{},
					documentDialogVisible:false,
				
					num:0,

				}
			},
			methods: {
        showDocument(index) {
          this.num=index
          this.document.documentId=this.documents[index].documentId
		  that.documentDialogVisible=true
          
        },

				updateDocumentSubmit(){
					let that=this
					let s=qs.stringify(that.documents[that.num])
					this.$axios.get("http://localhost:8080/document/documentupdate?"+s).then(function(res){
						that.documentUpdateDialog=false
					})

				}

			},
			created() {
				let u=JSON.parse(sessionStorage.getItem("user"))
				let that=this
				that.document.userId=u.userId
				let str=qs.stringify(that.document)
				this.$axios.get("http://localhost:8080/document/documentshow?"+str).then(function(res){
					that.documents=res.data
				})
			}
	}
</script>

<style>
</style>
